import { createBrowserRouter } from 'react-router-dom'
import { lazy } from 'react'
import App from '../App'

const Data1 = lazy(() => import('../pages/data1/Index'))
const Data2 = lazy(() => import('../pages/data2/Index'))

type homeRoutes = {
    path: string;
    element: JSX.Element;
    children: { path: string; element: JSX.Element; }[]
}[]

const routes:homeRoutes = [
    {
        path: '/',
        element: <App></App>,
        children: [
            {
                path: '/data1',
                element: <Data1></Data1>,
            },
            {
                path: '/data2',
                element: <Data2></Data2>,
            }
        ]
    }
]
const router = createBrowserRouter(routes)

export default router